function jsConfig(js_appId, js_timestamp, js_nonceStr, js_signature) {
    wx.config({
            debug: false,
            appId: js_appId,
            timestamp: js_timestamp,
            nonceStr: js_nonceStr,
            signature: js_signature,
            jsApiList: ['chooseWXPay','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ',
                'onMenuShareWeibo','scanQRCode', 'chooseImage', 'uploadImage']
        }
    )
}

function jsShare(title, link, imgUrl, desc, type, dataUrl) {
    type = 'link';
    dataUrl = '';
    wx.onMenuShareTimeline({
        title: title,
        link: link,
        imgUrl: imgUrl,
        success: function(){},
        cancel: function(){}
    });

    wx.onMenuShareAppMessage({
        title: title,
        desc: desc,
        link: link,
        imgUrl: imgUrl,
        type: type,
        dataUrl: dataUrl,
        success: function(){},
        cancel: function(){}
    });

    wx.onMenuShareQQ({
        title: title,
        desc: desc,
        link: link,
        imgUrl: imgUrl,
        success: function(){},
        cancel: function(){}
    });

    wx.onMenuShareWeibo({
        title: title,
        desc: desc,
        link: link,
        imgUrl: imgUrl,
        success: function(){},
        cancel: function(){}
    });
}

var configSuccess = function(resp){
    if(resp.code==0){
        jsConfig(resp.message.appId, resp.message.timestamp, resp.message.nonceStr, resp.message.signature)
    }else{
        alert(JSON.stringify(resp.message));
    }
};
var configFail = function(resp){
    console.log(resp);
};
var doConfig =function(){
    wfHttp.post("/common/wechat/config",{url:location.href.split('#')[0]},{succ: configSuccess,fail:configFail})
};
doConfig();